<?php

namespace app\common\model;

use think\Model;
use think\Db;

class Article extends Model
{

    /**
     * 获取文章分类的列表
     * @param $name     分类名称
     * @param int $page 页码
     * @param int $num  每页数量
     * @return mixed
     */
    public function getArticleList($name ,$page = 1, $num = 10){
        $list = [];
        $limit = $page * $num . ', ' . $num;
        $sql = 'select a.* from hel_article_cat p INNER JOIN hel_article a ON p.cat_id = a.cat_id WHERE a.is_open = 1 AND p.cat_name = ' . "'$name'".'  ORDER by sort_order asc limit ' . $limit;
        $list = Db::query($sql);
        return $list;
    }

}